/**
 * Created by Sunny on 2018/3/1.
 */
const user = {
  state:{
    sid: localStorage.getItem('sid'),
    employees: []
  },
  mutations:{
    SET_SID: (state, sid) => {
      state.sid = sid
      localStorage.setItem('sid', sid)
    },
    SET_EMPLOYEES: (state, employees) => {
      state.employees = employees
    },
    DESTORY_SID: (state) =>{
      state.sid = ''
      localStorage.clear()
    }
  },
  actions:{
    initSid: ({commit, state}, sid) => commit('SET_SID', sid),
    initEmployees: ({commit, state}, employees) => commit('SET_EMPLOYEES', employees),
    destorySid: ({commit, state}) => commit('DESTORY_SID')
  }
};
export default user;
